let _ = require("lodash");

function apiName(url) {
  return _.upperCase(url).split(" ").join("_");
}

function ajaxName(url) {
  let str = _.camelCase(url);
  let str1 = _.slice(str, 0, 1).join("");
  let str2 = _.slice(str, 1).join("");
  return "fetch" + _.upperCase(str1) + str2;
}

let url = "/ui_permission/get";

function gen(url) {
  let obj = {
    ajaxName: ajaxName(url),
    apiName: apiName(url),
    url: url,
  };
  return {
    ...obj,
  };
}

console.log(gen(url));
